package com.huang.controller;


import com.huang.entity.UserEntity;
import com.huang.service.UserService;
import com.huang.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/list")
    public Object selectList(){

        return userService.list();
    }

    @PostMapping("/insert")
    public void insert(){

        userService.insert(new UserEntity(null, "huang123", "huang123", "123123"));
    }

    @GetMapping("/date")
    public Object index(){

        return DateUtils.getCurrentDateToString();
    }

    @GetMapping("/user")
    public Object user(){

        return new UserEntity(null, "huang123", "huang123", "123123");
    }

    @GetMapping("/select")
    public Object select(){

        return userService.get();
    }
}
